package com.archermind.amosp;

import java.util.ArrayList;
import java.util.List;
import DataManager.DataManager;
import DataManager.MenuInfo;
import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;

public class AmospOrderFoodActivity extends ListActivity {
	
	public AmospOrderAdapter mListAdapter;
	private DataManager mDataManager;
	private ArrayList <MenuInfo> mMenuInfoList;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_amosp_order_food);
        
        ListView listView = getListView();
        // Tell the list view which view to display when the list is empty
        View emptyView = findViewById(R.id.empty);
        listView.setEmptyView(emptyView);
        initDataManager();
        initListAdapter();
	}
	
	private void initDataManager(){
		mDataManager = DataManager.getInstance();
		mDataManager.init();
	}
	
    private void initListAdapter() {
    	mMenuInfoList = mDataManager.getAllList(DataManager.ORDER_TYPE_FOOD);
        mListAdapter = new AmospOrderAdapter(this,mMenuInfoList);
        setListAdapter(mListAdapter);
        getListView().setRecyclerListener(mListAdapter);
    }

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		super.onListItemClick(l, v, position, id);
	}
	
	public DataManager getDataManager(){
		return mDataManager;
	}

}
